package bombita.modelo.Mapa;

import java.awt.Point;

public class Vector2D
{
	int x = 0;
	int y = 0;

	public Vector2D () {}
	
	public Vector2D (int nx, int ny)
	{
		x = nx;
		y = ny;
	}
	
	public Vector2D sumar (Vector2D delta)
	{
		return new Vector2D (this.x + delta.x, this.y + delta.y);
	}
	
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + x;
		result = prime * result + y;
		return result;
	}

	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Vector2D other = (Vector2D) obj;
		return (this.x == other.x) && (this.y == other.y);
	}

	public Point sumar (Point base)
	{
		return new Point (this.x + base.x, this.y + base.y); 
	}
	
	public Vector2D mult (int m)
	{
		return new Vector2D(m * this.x, m * this.y);
	}
}
